
clear all;
close all;

results = GSLpp_minimize("gsl_steepest_descent", struct, ...
                         struct, "extendedrosenbrock", struct("n", 2), ...
                         struct("f", "sym", "g", "sym", "H", "sym"), ...
                         "gradient", struct("eps", 1e-8), ...
                         [ -1.2, 1 ]', 0, false);

GSLpp_plot_results(results);
print([ "steepestdescent_test_extendedrosenbrock.ps" ], "-landscape", "-solid", "-mono", "-FArial:22");
close;

for si = linspace(1, 4, 4)
  f = [ "(", num2str(si), "*x)^2+y^2" ];
  x0 = [ 0.45 / si, 0.85 ];

  results = GSLpp_minimize("gsl_steepest_descent", struct, ...
                           struct, f, struct, ...
                           struct("f", "sym", "g", "sym", "H", "sym"), ...
                           "gradient", struct("eps", 1e-8), ...
                           x0, 0, false);

  x_range = [ -0.5 / si, 0.5 / si ];

  GSLpp_plot_results(results, { x_range, [ -0.1, 1 ], [ 1e-6, 10 ] }, [ false, false, false ]);
  print([ "steepestdescent_test_scale_", num2str(si), ".ps" ], "-landscape", "-solid", "-mono", "-FArial:22");
  close;
endfor
